<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->engine = 'InnoDB';

            $table->increments('id');
            $table->string('name', 50)->unique();
            $table->string('password', 255);
            $table->integer('group_id');
            $table->string('realname', 255)->default('');
            $table->string('token', 255);
            $table->integer('add_time');
            $table->integer('modify_time');
            $table->string('mobile', 11);
            $table->tinyInteger('status')->default(1);
            $table->string('mark', 255)->default('');
            $table->string('last_login_ip', 255);
            $table->integer('last_login_time');

            $table->index('name');
            $table->index('password');
            $table->index('group_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('users');
    }
}
